package com.xxkk.gameCore.net.sql.mapper;

import com.xxkk.gameCore.net.sql.pojo.UserInfo;
import com.xxkk.gameCore.net.sql.pojo.UserInfoExample;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.jdbc.SQL;

public interface UserInfoMapper {
    long countByExample(UserInfoExample example);

    int deleteByExample(UserInfoExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(UserInfo record);

    int insertSelective(UserInfo record);

    List<UserInfo> selectByExample(UserInfoExample example);

    UserInfo selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") UserInfo record, @Param("example") UserInfoExample example);

    int updateByExample(@Param("record") UserInfo record, @Param("example") UserInfoExample example);

    int updateByPrimaryKeySelective(UserInfo record);

    int updateByPrimaryKey(UserInfo record);

    @Select("SELECT * FROM tb_user WHERE name=#{name};")
    List<UserInfo> selectTest(@Param("name") String name);

    @Delete("DELETE FROM tb_user WHERE id = #{id} AND account=#{account};")
    int delByIdAndAccount(@Param("id") int id, @Param("account") String account);
//    @Select({"<script> select id, dept_name deptName from dept where pid  in (select id from dept where 1=1",
//            " <when test='deptName!=null and deptName.toString().length() != 0'> ",
//            "and dept_name = #{deptName}",
//            " </when> ",
//            " <when test='deptId != null and deptName.toString().length() != 0'> ",
//            "and id = #{deptId}",
//            " </when> ",
//            ")",
//            "</script>"})
//    public void select_();
    @Select("SELECT id,account FROM tb_user LIMIT #{index},#{limit};")
    UserInfo selectByLimit(@Param("index") int pageIndex,@Param("limit") int limit);
}